package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BrandMapper extends Mapper<Brand> {

    @Select("SELECT name,image FROM tb_brand WHERE id in (\n" +
            "SELECT brand_id FROM tb_category_brand WHERE category_id in(\n" +
            "SELECT id FROM tb_category WHERE name = #{name}))")
    List<Map> findListByCategoryName(@Param("name") String categoryName);

    @Select("SELECT name , OPTIONS FROM tb_spec WHERE template_id in(SELECT id FROM tb_template WHERE name = #{name})")
    List<Map> findSpecListByCategoryName(@Param("name")String categoryName);
}
